home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-23 | 20.0 KB | 637 lines | [TEXT/ttxt] |
- LOG
- captures MacDOS commands and their output.
-
- Syntax
- log [[file] [/A] [/O] | [/-]]
-
- Parameters
- file
- is the file to be used for storing captured information. It
- can include a volume and path spec. If file is missing, LOG
- closes the current logging file and stops logging.
-
- Switches
- /A
- appends logging data to the requested file instead of
- overwriting it.
-
- /O
- captures the output of commands. When /O is missing, only
- the commands themselves are captured.
-
- /-
- suppresses the storing of the closing message when closing
- a log file. You can then use a log file as a batch program
- without having to remove the closing message by hand. It
- only makes sense if the log file was opened WITHOUT the /O
- option.
-
- MacDOS vs DOS
- DOS does not support LOG.
-
- Notes
- File creator
- By default, LOG generates a file with creator 'ttxt' (for
- TeachText), but you can change it by SETting the system
- variable CREATOR.
-
- Frequently occurring errors
- E77: File already open for writing
- The file was already open in exclusive mode. Perhaps you
- were already using the same file for LOGging.
-
-
- MD, MKDIR
- create a folder (ie. MaKe a DIRectory).
-
- Syntax
- md name
- mkdir name
-
- The two commands are functionally identical.
-
- Parameters
- name
- is the name of the folder to be created. It can include a
- volume and path spec.
-
- MacDOS vs DOS
- The two implementations are identical.
-
- Examples
- Create a folder in the root directory:
- mkdir \foldName
- Create a subfolder of the current folder:
- mkdir subFold
- Create a folder in the same folder which contains the
- current one:
- mkdir ..\sisterFold
- Create a folder in the current folder of volume D:
- mkdir D:newFold
-
- Frequently occurring errors
- E58: Duplicate filename(s)
- There is already a folder or a file with the same name in
- the same place. Remember that names are NOT case sensitive.
-
- See Also
- RD, RMDIR, CD, CHDIR
-
-
- MEM
- provides information on the list of executing processes.
-
- Syntax
- mem
-
- MacDOS vs DOS
- MacDOS provides information similar to what is provided in
- DOS by the command MEM /PROGRAM . There are two main
- differences:
- • MacDOS does not provide information on system globals.
- • MacDOS provides additional information like the creator
- string and the path of the application file.
-
-
- MORE
- displays the content of a text file one page (ie. one
- window-full) at a time.
-
- Syntax
- more < file
- chain | more
-
- Parameters
- file
- is the name of a text file, possibly preceded by a volume
- and path spec. When file is missing, MORE accepts input
- from the keyboard. Input can then be terminated by typing a
- cntl-Z (that the Macintosh interprets as an EOF), a cntl-C,
- or a cmd-dot.
-
- chain
- is a chain of piped MacDOS filters, possibly including
- parameters and switches and beginning with a command. In
- its simplest form, a chain simply consists of a MacDOS
- command that accepts output redirection.
-
- MacDOS vs DOS
- MacDOS does not prompt the user at the end of each page
- when the output is redirected to a disk file.
-
- DOS only allow MORE to be preceded by a single command.
-
- Notes
- Generating text files
- You can generate small text files by executing MORE without
- parameters by redirecting its output to a disk file:
- more > newFile
- MORE then keeps storing what you type into newFile until
- you type a cntl-Z. If your keyboard does not have the CNTL
- key, you can type cmd-dot instead. Nevertheless, as a cmd-
- dot aborts the current line, you should only type it after
- the last RETURN.
- This method of producing text files is only practical for
- batch programs of a couple of lines or small files for test
- purposes.
-
- Examples
- more < \documents\myTextFile
- myFilter < filterInput | more
- dir | more
- help xcopy | more
- dir/b/a-d | filter1 | filter2 | more
-
- Frequently occurring errors
- E40: Not a file of type 'TEXT'
- MORE can only display text files.
-
- See Also
- TYPE
-
-
- NEXT
- terminates a multi-line FOR-loop.
-
- Syntax
- next varname
-
- Parameters
- varname
- is the control variable of the FOR-loop.
-
- MacDOS vs DOS
- DOS does not support NEXT.
-
- Notes
- Jumping in and out of FORs
- If you jump into a FOR-loop with a GOTO, MacDOS does not
- automatically report an error. This is partly due to the
- fact that MacDOS ignores the NEXT command if the control
- variable does not exist. You should always enter loops from
- the top. If a FOR-loop is exited with a GOTO before it is
- completed, MacDOS "remembers" that the loop was not
- completed and does not release the control variable.
- Therefore, it is possible to jump out, do something, and
- jump back in.
- If you jump out of a FOR-loop and then try to restart it
- from the beginning, MacDOS reports the error message:
- Variables used in iterations must be unique
- because the control variable was not released.
-
- See Also
- FOR
-
-
- ONERROR
- specifies a label for error handling in batch.
-
- Syntax
- onerror [label]
-
- Parameters
- label
- is a label from which batch execution continues whenever
- MacDOS encounters an error. When this parameter is missing,
- ONERROR resets the error handling.
-
- MacDOS vs DOS
- DOS does not support ONERROR.
-
- Notes
- Standard handling
- After detecting an error, MacDOS aborts the current command
- and continues execution of the batch program from the
- following line.
-
- Error routine
- You can implement an error routine by setting a variable
- with a return label:
- onerror ERR_LBL
- set return_lbl=RET_LBL
- if this line causes an error we resume execution from
- ERR_LBL
- :RET_LBL
- here is where we come back from the error routine
- ...
- :ERR_LBL
- here we handle the error before resuming normal
- execution
- goto %return_lbl%
-
- Examples
- onerror
- onerror ERR_LBL
- onerror %var%
-
- See Also
- SHOW
-
-
- OPEN
- opens a text file for sequential access.
-
- Syntax
- open [file [var]] [{/R | /W | /A}]
-
- Parameters
- file
- is the name of a file of type 'TEXT', possibly preceded by
- a volume and path spec. When file is missing, OPEN displays
- the list of files already open. After being OPENed, the
- file can be accessed with the commands READ or WRITE and
- closed with CLOSE.
-
- var
- is the name of the variable into which the fileID is to be
- stored. When var is missing, OPEN displays the fileID in
- the MacDOS window.
-
- Switches
- Only one of /R, /W, and /A at a time is allowed in a
- command. When no switch is provided, /R is assumed.
-
- /R
- opens an existing text file to read (see the command READ).
- If the file does not exist, OPEN fails.
-
- /W
- opens a new text file to write (see the command WRITE). If
- the file already exists, OPEN replaces it with the new one.
-
- /A
- opens an existing text file to write past the current EOF
- (see the command WRITE). If the file does not exist, OPEN
- creates it.
-
- MacDOS vs DOS
- DOS does not support OPEN.
-
- Notes
- Forks
- OPEN only sees the data fork of text files.
-
- Non-text files
- You can READ the data fork of a file not of type 'TEXT' by
- copying it:
- COPY/D filename theCopy
- and changing its type:
- REN theCopy /t!TEXT
- (at this point, you can also use TYPE and MORE to display
- it).
-
- Concurrent access
- The same file can be opened more than once for reading but
- only once for writing. This also applies to files opened
- directly by MacDOS (eg. to read a batch program or for I/O
- redirection) or by other applications (compilers, word
- processors, etc.). You should not change the content of a
- file while it is being read. When you OPEN a file, MacDOS
- keeps in memory the current file offset and has no way of
- checking whether it remains valid. Therefore, it is of
- particular importance that the length of the portion
- already READ remains unchanged.
-
- File reset
- If you OPEN a file for writing and CLOSE it immediately
- thereafter, this will have the effect of removing its
- content, while leaving its creator unchanged.
-
- Examples
- open myFile
- open 2:\aFold\aFile aVar /R
- open memoList saveID /a
- open
-
- Frequently occurring errors
- E27: File or directory not found
- When OPENing for reading, the parameter did not identify
- any file at all. Alternatively, one of the directories
- specified in the path could not be found.
-
- E34: Illegal wildcarding
- You were trying to open a folder instead of a file: MacDOS
- tried to open all the files contained in the folder and
- then failed because OPEN can only open a file at a time.
-
- E40: Not a file of type 'TEXT'
- You can only OPEN text files. Perhaps you forgot to save it
- from your word processor as "text only".
-
- E77: File already open for writing
- The file to be OPENed for writing was already open in
- exclusive mode, either by MacDOS or by another application.
- Check what files you have opened in your word processor
- and/or editor. Some applications fail to close a file when
- you close the corresponding window (yes, it is a bug!). In
- those cases, you will have to quit the application in order
- to free the file.
-
- See Also
- READ, WRITE, CLOSE
-
-
- PATH
- displays and sets search paths for executable files.
-
- Syntax
- path [paths]
-
- "PATH paths" is equivalent to "SET PATH=paths"
-
- Parameters
- paths
- is a list of paths separated by semicolons. If paths is
- missing, PATH displays the current list. If paths consists
- of a single semicolon, PATH resets the list.
-
- MacDOS vs DOS
- The two implementations are identical.
-
- Notes
- Global variable PATH
- MacDOS stores the list of paths in a global system variable
- named PATH. Therefore, the command
- path listOfPaths
- is completely equivalent to
- set path=listOfPaths
- Similarly,
- path ;
- is equivalent to
- set path=
-
- Changing the current PATH
- You can easily append a new folder to the current PATH by
- typing any of the following three commands:
- path %path%;newFolder
- set path=%path%;newFolder
- incr path by ;newFolder
-
- Similarly, to insert a new folder at the beginning of the
- current PATH, you can type:
- path newFolder;%path%
- set path=newFolder;%path%
- incr -path by newFolder;
-
- Also look at the batch programs addPath.bat and delPath.bat
- in the batches folder of the MacDOS floppy.
-
- Order of searching and multiple filenames
- MacDOS looks for executable files in the current folder
- (first without extension, then after appending the
- extensions .BAT) before scanning the folders identified in
- the global variable PATH.
-
- When looking for an executable file or a file of
- abbreviations, MacDOS scans the paths from left to right
- until it finds a file with the correct name. Therefore,
- when several files with the same name are in the different
- folders of the path, MacDOS only sees the first one.
-
- Examples
- path ;
- path
- path "c:\;\bin;1:\application folder;1:\batches"
-
-
- PAUSE
- suspends execution of a batch program and asks whether
- execution should be resumed.
-
- Syntax
- pause
-
- MacDOS vs DOS
- The two implementations are identical.
-
- Notes
- PAUSE vs cntl-C
- PAUSE lets you interrupt a batch program in a controlled
- way, while a cntl-C (or cmd-dot) interrupts batch execution
- asynchronously. After being PAUSEd, a batch program can
- always continue without problems. On the other hand, cntl-C
- is risky, because it actually interrupts individual
- commands. When you resume execution after a cntl-C, MacDOS
- does NOT complete the command which was interrupted, but
- simply continues with the next line of the batch program.
-
-
- PRINT
- prints a text file.
-
- Syntax
- print [file] [/P] [/D]
-
- Parameters
- file
- specifies what is to be printed. It can be a filename, a
- wildcarded filename, or a folder name, possibly preceded by
- a volume and path spec. If file is omitted, PRINT prints
- the text contained in the console window.
-
- Switches
- /P
- prompts you for confirmation before printing each file.
-
- /D
- displays the standard Print dialog before printing the
- file. When printing a wildcarded series of files, the
- dialog is only displayed before printing the first file of
- the series. The parameter settings are then applied to all
- following prints until you execute PRINT/D once more.
-
- MacDOS vs DOS
- Options and parameters
- MacDOS supports none of the DOS options, but it can prompt
- you with the switch /P and /D. Only one parameter is
- accepted by MacDOS, but it can be wildcarded or specify a
- folder.
-
- Notes
- Page Setup and Print console menu items
- The "Page Setup..." item in the "File" menu behaves in the
- usual way. The "Print console..." item prints what is in
- the MacDOS window.
-
- Print dialog box
- By default, the command PRINT does not put up the usual
- Macintosh dialog box. Thefeore, it lets you print several
- text files without having to click the mouse for each one
- of them. It normally prints one copy of each entire file
- but you can change the default via the "Print console..."
- item of the "File" menu or the switch /D. MacDOS will then
- apply the same settings when executing PRINT until you
- change them again.
-
- Form Feeds
- When MacDOS encounters a line which begins with a FF
- character (cntl-L = 0x0C), it executes a form feed without
- printing that line.
-
- Examples
- print "\myProject folder\sources\*.c"
- print \mixedFiles /p
- print "a file" /D
-
- Frequently occurring errors
- E27: File or directory not found
- The parameter did not identify any file at all or one of
- the directories specified in the path could not be found.
-
- E40: Not a file of type 'TEXT'
- You can only PRINT text files. Perhaps you forgot to save
- it from your word processor as "text only".
-
-
- PROMPT
- changes the command prompt.
-
- Syntax
- prompt [text]
-
- "PROMPT text" is equivalent to "SET PROMPT=text"
-
- Parameters
- text
- specifies what you want to have in the command prompt. When
- PROMPT encounters in text a dollar sign, it interprets the
- following character as a request to insert special strings
- into the command prompt. The possible requests are:
- $B | (pipe)
- $D current date
- $E escape (ASCII code 27)
- $G > (greater-than sign)
- $H backspace (erases the previous character)
- $L < (less-than sign)
- $N current volume
- $P current volume and path
- $Q = (equal sign)
- $T system time
- $V MacDOS version number
- $_ new-line
- $$ $ (dollar sign)
- When text is missing, PROMPT resets the command prompt to
- the default string ($N$G).
-
- MacDOS vs DOS
- The two implementations are identical.
-
- Notes
- Date and Time formats
- The date and time formats are set with DATE and TIME
- respectively.
-
- Paths and dismounted volumes
- If you EJECT a floppy while you are attached to it and your
- command prompt contains $P, you will get the error message
- "No such volume" after every prompt. To avoid such an error
- message you should attach to a mounted volume. Naturally,
- you could also remove the $P from the prompt string.
-
- Examples
- command prompt
- prompt $p$g C:\MacDOS folder>
-
- prompt "Now: $t$$" Now: 13:33:16$
-
- prompt $d;$t$_$v ! 94-09-30;13:35:10
- 2.0.0 !
-
- See Also
- DATE, TIME, VER, VOL, CD
-
-
- RD, RMDIR
- delete an empty folder (ie. ReMove a DIRectory).
-
- Syntax
- rd name
- rmdir name
-
- The two commands are functionally identical.
-
- Parameters
- name
- is the name of the folder to be removed. It can include a
- volume and path spec.
-
- MacDOS vs DOS
- The two implementations are identical.
-
- Notes
- RMDIR vs. DEL
- DEL followed by a folder name deletes all the files in the
- folder, while RMDIR followed by the same folder name
- actually removes the folder (if it is empty).
-
- Examples
- Removes a folder from the root directory:
- rmdir \foldName
- Removes a subfolder of the current folder:
- rmdir subFold
- Removes a folder from the same folder which contains the
- current one:
- rmdir ..\sisterFold
- Removes a folder from the current folder of volume D:
- rmdir D:oldFold
- Removes a folder from the root directory of volume D:
- rmdir D:\aFold
-
- Frequently occurring errors
- E49: File busy, dir non empty, or path error
- RMDIR can only remove a folder if it is empty.
-
- See Also
- MD, MKDIR, CD, CHDIR
-
-
- READ
- reads a line of text from a file opened with OPEN.
-
- Syntax
- read fileID [var]
-
- Parameters
- fileID
- is the number returned by OPEN. The file can be closed with
- the command CLOSE, but MacDOS closes it automatically when
- it encounters the EOF.
-
- var
- is the name of the global variable into which the read line
- is to be stored. If var is omitted, MacDOS displays the
- line in the MacDOS window.
-
- MacDOS vs DOS
- DOS does not support READ.
-
- Notes
- Line termination
- READ strips the newline character (CR) at the end of each
- line containing more than one character. If the CR is the
- only character in the line, MacDOS replaces it with a
- space. This guarantees that the line returned is never
- empty.
-
- Examples
- read 3 reads a line from file #3 and
- displays it on the monitor's screen.
-
- read %fileID% aLine reads a line from the file whose ID
- is stored in the variable fileID and
- stores it into the variable aLine.
-
- read %2 reads a line from the file whose ID
- was passed to the batch program via
- the second replaceable parameter.
-
- Frequently occurring errors
- E3: File not opened by the user
- The file you wanted to READ was not opened. Remember that
- MacDOS automatically closes the file when you reach the
- EOF.
-
- See Also
- OPEN, WRITE, CLOSE
-
-